import React from "react";
import { connect } from "react-redux";

import { addAction } from "./store/actionCreator";

const mapStateToProps = (state) => {
  return {
    count: state.count,
  };
};
const mapDispatchToProps = (dispatch) => {
  return {
    add() {
      dispatch(addAction());
    },
  };
};

const App = (props) => {
  return (
    <>
      <h2>redux异步</h2>
      <span>{props.count}</span>
      <button onClick={props.add}>+</button>
    </>
  );
};

export default connect(mapStateToProps, mapDispatchToProps)(App);
